<?php
class singlepageController extends accessController{
    public static function _right(){
        return array(
            array('单页管理',1),
            array('单页添加','add,add_'),
            array('单页列表','mylist'),
            array('单页编辑','mod,mod_'),
            array('单页删除','del'),
            array('批量操作','bit_op'),
        );
    }
	public function s(){
		return array('singlepage');
	}
	public function add(){
		$mysort=time();
		include($this->viewer_dir.'singlepage/add.php');
	}
	public function add_(){
    	if($_POST){
			$r=$this->s_0->add_($_POST);
			autoalert($r[0],$r[1]);
			back();
        }
    }
	public function mylist(){
	    
		$condition=array();
		$extra='';
		
	    $return=$this->s_0->li($condition,$extra);
		include($this->viewer_dir.'singlepage/mylist.php');
	}
	public function mod(){
        $id=intval($_GET['id']);
        if($id>0){
            $data=$this->s_0->mod($id);
            if($data){
                include($this->viewer_dir.'singlepage/mod.php');
            }
        }
    }
    public function mod_(){
		$id=intval($_GET['id']);
        if($_POST and $id>0){
            $r=$this->s_0->mod_($_POST,$id);
            autoalert($r[0],$r[1]);
            back();
        }
    }
	public function del(){
		$id=intval($_GET['id']);
        if($id>0){
            $r=$this->s_0->del($id);
            autoalert($r[0],$r[1]);
            back();
        }
	}
    //批量操作 文章列表页调用
	public function bit_op(){
		if(empty($_POST)) exit;
		$k=$_GET['k'];
		$items=$_POST['items'];
		if(empty($items)) exit;
		switch($k){
			case 'make_html'://已做
			$this->s_0->make_html($items);
			break;
			default:
			exit('k error!');
			break;
		}
		alert('操作成功！');
		back();
	}
//
}